package com.kede.ienum.order;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/***
 ** @Author:Pr.li
 ** @Description:
 ** @Date: create in 2023/5/16 9:05
 ***/
@Getter
@AllArgsConstructor
public enum OrderStatusEnum {
//之前是  订单状态:-3=异常订单,-2=驳回, -1=取消订单,0=未支付,1=已支付,2=已发货,3=已签收,4=退货中,5=已退款
    NOPAY(1,"待付款",1),
    SEND(2,"待发货",2),
    RECEIVEING(3,"待收货",3),
    RECEIVE(4,"已签收",4),
    OFFLINERECEIVE(5,"待领取",5), //线下单 支付后 出现的状态
    RETURN(6,"申请退货",6),
    RETURNED(7,"退货中",7),
    RETURNMONEY(8,"退款中",8),
    FINISH(99,"已完成",9),
    CANCEL(100,"已取消",10);

    @EnumValue
    private Integer code;
    private String value;
    private Integer enumIndex;

    public static OrderStatusEnum parse(Integer code) {
        for (OrderStatusEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}
